<template>
  <j-modal title="人员标签变更" :width="800" :visible="visible" @cancel="handleCancel" @ok="handleOk">
    <div>
      <a-form-model
        ref="ruleForm"
        :model="form"
        :rules="rules"
        :label-col="labelCol"
        :wrapper-col="wrapperCol"
      >
        <a-form-model-item label="人员类型">
          <j-dict-select-tag
            v-model="profileType"
            dictCode="personType"
            placeholder="请选择人员类型"
            :disabled="true"
            style="min-width: 100px"
          />
        </a-form-model-item>
        <a-form-model-item label="人员标签" prop="sjsk_user_tag_type">
          <j-dict-select-tag
            v-model="form.sjsk_user_tag_type"
            :dictCode="this.ShmXdsRF ? 'Rtag' : 'ShmXds'"
            placeholder="请选择人员类型"
            style="min-width: 100px"
          />
        </a-form-model-item>
      </a-form-model>
    </div>
  </j-modal>
</template>
<script>
//ShmXds
import {tagUpdate} from "@api/sjsk/archives";

export default {
  name: 'AddModal',
  props:['profileType'],
  data() {
    return {
      visible: false,
      form: {
        // profileType:this.$route.query.val.profileType,
      },
      ShmXdsRF:true,
      labelCol: { span: 4 },
      wrapperCol: { span: 8 },
      rules:{
        sjsk_user_tag_type:[{ required: true, message: '请选择人员类型', trigger: 'blur' }]
      },
    }
  },
  async created() {
  },
  mounted() {
    console.log(this.profileType)
    if(this.profileType === '1' || this.profileType === '2') {this.ShmXdsRF = true}
    else {this.ShmXdsRF = false}
  },
  methods: {
    show() {
      this.visible = true
    },
    onStartChange() {

    },
    onChange(e) {

    },
    onSwitchChange(e) {

    },
    handleCancel() {
      this.visible = false
      this.form = {}
    },
    handleOk() {
      this.$refs.ruleForm.validate(valid => {
        if (valid) {
          tagUpdate(this.form).then(ser => {
            if(ser.success){
              this.$message.success('更新成功')
              this.visible = false
            } else {
              this.$message.info(ser.message)
            }
          })
        }
      })

    }
  },
}
</script>
<style lang="less" scoped>
.l-form{
  display: flex;
  align-items: center;
  margin-top: -5px;
}
.display>*{
  margin: 5px;
}
</style>
